package cn.biplam.front.component.view.systemManage.sysprivi.role.manage.privi;

import cn.biplam.common.ajxcode.SystemCode.RoleManageCode;
import cn.biplam.common.bean.systemManage.privi.RoleManageBean;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.KvMap;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.ComponentBase;
import cn.biplam.front.component.view.systemManage.sysprivi.role.RoleManage;
import cn.biplam.front.html.HtmlDiv;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.htmlscript.script.AjxScript;
import cn.biplam.front.template.control.Confirm;

/**
 *  删除角色权限
 * @author XiaoRuxing Dec 10, 20095:23:48 PM
 * @version 1.0
 */
public class DelRolePrivi extends ComponentBase{
	
	public DelRolePrivi(UserInfo user, String homeUrl, String recordId,
			KvMap<String, String> params) {
		super(user, homeUrl, recordId, params);
	}

	/**
	 *  
	 * @return 删除角色权限提示界面
	 * @throws ErrorMessage 
	 */
	public HtmlWindow get() throws ErrorMessage{
		Confirm delete = new Confirm("确定删除角色权限"+""+"?",recordId, null);
		delete.bind(RoleManage.Role_Privi_Del_Submit);
		return delete.get();
	}
	
	/**
	 *  删除角色权限提交
	 * @return 刷新脚本
	 * @throws ErrorMessage 
	 */
	public HtmlWindow submit() throws ErrorMessage{
		//执行删除角色权限
		RoleManageBean roleMange = RoleManageBean.getInstance(mUser.getUserID());
		roleMange.delRolePrivi(recordId, false);
		//返回刷新角色权限列表脚本
		HtmlWindow win = new HtmlDiv();
		win.bind(AjxScript.getA(RolePriviMain.cId, RoleManageCode.Role_Info));
		return win;
	}
}
